package game;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

public class MainMenuState extends JPanel implements WindowComponent{

	private static final long serialVersionUID = 1L;
	private  JButton loginButton;
	private  JButton optionButton;
	private  JButton registerButton;
	private  JButton leaderboardButton;
	private  JButton creditsButton;
	private  JButton exitButton;
    LoadImage images = new LoadImage();

	public MainMenuState() {
	     setLayout(null);
	     intialize(); 
		
	}



	private void intialize() {
		
		loginButton = new JButton("Login");
		loginButton.setBounds(44, 120, 275, 45);
		loginButton.setOpaque(false);
		loginButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				FRAME.getContentPane().removeAll();
				FRAME.getContentPane().add(STATISTICS_PANEL).setVisible(true);
				MENU_PANEL.setVisible(false);
				
			}
		});
		
		registerButton = new JButton("Register");
		registerButton.setBounds(44, 180, 275, 45);
		registerButton.setOpaque(false);
		
		optionButton = new JButton("Option");
		optionButton.setBounds(44, 240, 275, 45);
		optionButton.setOpaque(false);
		optionButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				FRAME.getContentPane().removeAll();
				FRAME.getContentPane().add(OPTION_PANEL).setVisible(true);
				MENU_PANEL.setVisible(false);
				
			}
		});

		leaderboardButton = new JButton("Leaderboard");
		leaderboardButton.setBounds(44, 320, 275, 45);
		leaderboardButton.setOpaque(false);
		leaderboardButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				FRAME.getContentPane().removeAll();
				FRAME.getContentPane().add(LEADERBOARD_PANEL).setVisible(true);
				MENU_PANEL.setVisible(false);
				
			}
		});
		creditsButton = new JButton("Credits");
		creditsButton.setBounds(44, 400, 275, 45);
		creditsButton.setOpaque(false);
		creditsButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				FRAME.getContentPane().removeAll();
				FRAME.getContentPane().add(CREDITS_PANEL).setVisible(true);
				MENU_PANEL.setVisible(false);
				
			}
		});


		exitButton = new JButton("Exit");
		exitButton.setBounds(44, 480, 275, 45);
		exitButton.setOpaque(false);
		exitButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				System.exit(0);
				
			}
		});

		
		add(loginButton);
		add(optionButton);
		add(leaderboardButton);
		
		add(creditsButton);
		add(exitButton);
		add(registerButton);
		
	}

}
